package com.fz.song.enums;

/**
 * Created by sfz on 2017/10/17.
 */
public enum UserEnum {

    USER_NORMAL(1001, "用户正常"),
    USER_LOCK(1002, "用户锁定"),
    USER_QUIT(1003, "用户离职");


    private int code;
    private String value;

    UserEnum(int code, String value) {
        this.code = code;
        this.value = value;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public UserEnum getValByCode(int code) {
        for (UserEnum exceptionEnum : UserEnum.values()) {
            if (exceptionEnum.code == code) {
                return exceptionEnum;
            }
        }
        throw new IllegalArgumentException("找不到该code: " + code);
    }


}
